package ru.pstu.itas.themerchant;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ItemsActivity extends Activity {

	public static final String TAG_FIELD = "tag";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View.OnClickListener listener = new View.OnClickListener() {
			public void onClick(View v) {
				showItem(((Button) v).getText().toString());
			}
		};
		setContentView(new ItemsListView(this, getAssets(), listener, getIntent().getExtras().getString(TAG_FIELD)));
	}

	public void showItem(String title) {
		Intent intent = new Intent();
		intent.setClass(this, ItemActivity.class);
		intent.putExtra(ItemActivity.TITLE_FIELD, title);
		startActivity(intent);
	}

}
